const express = require('express');
const router = express.Router();
// 引进mockjs
const Mock = require('mockjs');

// 监听路由
router.get('/list', (req, res) => {
    // 准备随机数据
    var data = {
        code: 0,
        success: true,
        data: Mock.mock({
            'hornList|10': [
                {
                    'id|+1': 1,
                    content: '@ctitle(30)',
                },
            ],
            'newsList|10': [
                {
                    'id|+1': 1,
                    title: '@ctitle(5)',
                    newsImg: "@Image('300x100','@color','image')",
                },
            ],
        }),
    };
    res.end(JSON.stringify(data));
});

module.exports = router;
